package com.ceshiren.springstudy.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * @author gaoxiaoqi
 * @date 2024/6/3 21:41
 * @description
 */
@RestController
@RequestMapping("/t")
@Api(tags = "BaseGetController: controller用户登录get请求类")
public class BaseGetController {


    @GetMapping("/gao")
    public String getMethodDemo1() {
        return "Hello Spring Boot !!! 内心最重要";
    }

    @GetMapping("/xiao/{id}")
    @ApiOperation("用于描述改方法的用途和作用")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "用户请求id")
    })
    public String getMethodDemo2(@PathVariable String id) {
        return "Hello Spring Boot !!!  " + id;
    }

    @GetMapping("/native")
    public String getMethodDemo3(@RequestParam(defaultValue = "北京", required = true) String sid) {
        return "Hello Spring Boot !!!  " + sid;
    }

    @GetMapping("/topic/{id}")
    @ApiOperation("加了sid参数，以及路径id")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "id描述"),
            @ApiImplicitParam(name = "sid",value = "sid描述")
    })
    public String getMethodDemo4(@PathVariable("id") String id, @RequestParam(name = "sid", defaultValue = "高晓琪") String sidValue) {
        return "Hello Spring Boot !!! " + id + "   " + sidValue;
    }


    @GetMapping("/top/{city}/{year}")
    public String getMethodDemo5(@PathVariable("city") String city, @PathVariable("year") String year,
                                 @RequestParam(name = "d", defaultValue = "描述") String describe,
                                 @RequestParam(defaultValue = "100", name = "m") String money) {
        return "Hello Spring Boot !!!  城市：" + city + " 年限：" + year + " 描述：" + describe + " money：" + money;
    }

}
